//: control/VowelsAndConsonants.java
// Demonstrates the switch statement.
import java.util.*;
import static net.mindview.util.Print.*;

enum Alph  {
	VOWEL('a','e','i','o','u'),
	SOMETIOMES_A_VOWEL('y','w'),
	CONSONANT();
	private HashSet<Character> chars = new HashSet<>();
	Alph(Character ...c) {
		chars.addAll(Arrays.asList(c));
	}
	public static Alph getAlph(char c) {
		if (VOWEL.chars.contains(c)) {
			return VOWEL;
		} else if (SOMETIOMES_A_VOWEL.chars.contains(c)) {
			return SOMETIOMES_A_VOWEL;
		} else {
			return CONSONANT;
		}
	}
}

public class VowelsAndConsonants {
  public static void main(String[] args) {
    Random rand = new Random(47);
    for(int i = 0; i < 100; i++) {
      char c = (char) (rand.nextInt(26) + 'a');
      printnb((char)c + ", " + c + ": ");
      print(Alph.getAlph(c));
    }
  }
} /* Output:
y, 121: Sometimes a vowel
n, 110: consonant
z, 122: consonant
b, 98: consonant
r, 114: consonant
n, 110: consonant
y, 121: Sometimes a vowel
g, 103: consonant
c, 99: consonant
f, 102: consonant
o, 111: vowel
w, 119: Sometimes a vowel
z, 122: consonant
...
*///:~
